<template>
<el-dialog title="详情"
           :close-on-click-modal="false" append-to-body
           :visible.sync="visible" class="JNPF-dialog JNPF-dialog_center" lock-scroll
           width="600px">
<el-row :gutter="15" class="">
<el-form ref="elForm" :model="dataForm" size="small" label-width="100px" label-position="right" >
    <template v-if="!loading">
            <el-col :span="24" >
                <el-form-item  label="制单人"  
 prop="maker" >
                        <p>{{dataForm.maker}}</p>
                </el-form-item>
            </el-col>
            <el-col :span="24" >
                <el-form-item  label="单据日期"  
 prop="date" >
                        <p>{{dataForm.date}}</p>
                </el-form-item>
            </el-col>
            <el-col :span="24" >
                <el-form-item  label="审批人"  
 prop="approver" >
                        <p>{{dataForm.approver}}</p>
                </el-form-item>
            </el-col>
    <el-col :span="24"  >
    <el-form-item label-width="0">
            <div class="JNPF-common-title">
                <h2>设计子表</h2>
            </div>
    <el-table :data="dataForm.tpurchasebList" size='mini'   >
        <el-table-column type="index" width="50" label="序号" align="center" />
            <el-table-column prop="supname" label="供应商名称">
            <template slot-scope="scope">
                            <p>{{scope.row.supname}}</p>
        </template>
        </el-table-column>
            <el-table-column prop="dataname" label="物料名称">
            <template slot-scope="scope">
                            <p>{{scope.row.dataname}}</p>
        </template>
        </el-table-column>
            <el-table-column prop="count" label="数量">
            <template slot-scope="scope">
                            <p>{{scope.row.count}}</p>
        </template>
        </el-table-column>
    </el-table>
    </el-form-item>
    </el-col>
    </template>
</el-form>
    </el-row>
    <span slot="footer" class="dialog-footer">
        <el-button @click="visible = false"> 取 消</el-button>
    </span>
    </el-dialog>
</template>
<script>
    import request from '@/utils/request'
    import PrintBrowse from '@/components/PrintBrowse'
    import jnpf from '@/utils/jnpf'
    export default {
        components: {PrintBrowse},
        props: [],
        data() {
            return {
                visible: false,
                loading: false,
                printBrowseVisible: false,
                printId: '',
            dataForm: {
                id :'',
                            maker : '',
                            date : '',
                            approver : '',
                        tpurchasebList:[],
            },

        }
        },
        computed: {},
        watch: {},
        created() {

        },
        mounted() {},
        methods: {
            dataInfo(dataAll){
                let _dataAll =dataAll
                for(let i=0;i<_dataAll.tpurchasebList.length;i++){
                    var _list = _dataAll.tpurchasebList[i];
                }
                this.dataForm = _dataAll
            },

            init(id) {
                this.dataForm.id = id || 0;
                this.visible = true;
                this.$nextTick(() => {
                    if(this.dataForm.id){
                        this.loading = true
                        request({
                            url: '/api/example/TPurchaseA/detail/'+this.dataForm.id,
                            method: 'get'
                        }).then(res => {
                            this.dataInfo(res.data)
                            this.loading = false
                        })
                    }

                })
            },
        },
    }

</script>
